package crp.services.api.graphql.models;

import crp.core.portal.domain.models.UpdateNewsArticleCommand;
import com.qwlabs.storage.models.StorageObject;
import lombok.Getter;
import lombok.Setter;
import org.eclipse.microprofile.graphql.Input;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

@Input("UpdateNewsArticleInput")
@Getter
@Setter
public class UpdateNewsArticleInput {
    @NotNull
    private String id;
    @NotNull
    @NotBlank
    private String title;
    @NotNull
    @NotBlank
    private String content;
    private StorageObject cover;

    public UpdateNewsArticleCommand createCommand() {
        return UpdateNewsArticleCommand.builder()
                .id(id)
                .title(title)
                .content(content)
                .cover(cover)
                .build();
    }
}
